package com.aaa.service.impl;

import com.aaa.dao.F_QuanXianDao;
import com.aaa.entity.F_Menu;
import com.aaa.service.F_QuanXianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class F_QuanXianServiceimpl implements F_QuanXianService {
    @Autowired
    F_QuanXianDao dao;

    @Override
    public List<Map> selectList(Map map) {
        return dao.selectList(map);
    }

    @Override
    public Integer getCount(Map map) {
        return dao.getCount(map);
    }

    @Override
    public int update(Map map) {
        return dao.update(map);
    }

    @Override
    public List<F_Menu> selectListid(Integer rid) {
        return dao.selectListid(rid);
    }

    @Override
    public void del(Map map) {
        dao.del(map);
    }

    @Override
    public int updaterRole(Map map) {
        String id="";
   /*     for (Object in : map.keySet()) {
                  //map.keySet()返回的是所有key的值
                  String str = (String) map.get(in);//得到每个key多对用value的值
                    System.out.println(in + "     " + str);
              }*/
        String ids= (String) map.get("ids");
        String[] sss=ids.split(",");
        Integer rid= (Integer) map.get("rid");

       // System.out.println(rid);
       for (int i = 0; i <sss.length ; i++) {
           id=sss[i];
           // System.out.println(id);
           //获取id， rid 添加进去
        dao.updaterRole(id,rid);
        }
        return 1;
    }

    @Override
    public int add(Map map) {
        return dao.add(map);
    }

    @Override
    public List<Map> selectListid2(Integer rid) {
        return dao.selectListid2(rid);
    }


}
